<template>
  <el-dialog v-el-drag-dialog title="流程表单" :visible.sync="visible" :append-to-body="appendToBody" :before-close="onClose">
    <div class="test-form">
      <parser :key="new Date().getTime()" :form-conf="formConf" @submit="onSave" @close="onClose" />
    </div>
  </el-dialog>
</template>

<script>
import Parser from '@/components/Parser'

export default {
  name: "FormDetailDialog",
  components: {
    Parser
  },
  data() {
    return {
      visible: false,
      appendToBody: false,
      formConf: {}
    }
  },
  methods: {
    init(content) {
      this.visible = true
      this.$nextTick(() => {
        this.formConf = JSON.parse(content)
      })
    },
    onSave() {
      this.$emit('confirmForm')
    },
    onClose() {
      this.formConf = {}
      this.visible = false
    }
  }
}
</script>

<style lang="scss" scoped>
.test-form {
  margin: 15px auto;
  width: auto;
  padding: 15px;
}
</style>
